﻿@model InsightAuto.Domain.Core.Article

@{
    ViewBag.Title = "Edit";
}

@section pageHeader{
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/xheditor-1.1.13-zh-cn.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#datepicker").datepicker({
            altField: "#SubmitTime",
            altFormat: "DD, d MM, yy"
        });

        $("#Content").xheditor({ upImgUrl: "@Url.Action("Upload", ControllerNames.Content)", upImgExt: "jpg,jpeg,gif,png", upFlashUrl: "@Url.Action("Upload", ControllerNames.Content)", upFlashExt: "swf"});
    });
</script>
}

<h2>Edit</h2>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Article</legend>

        @Html.HiddenFor(model => model.ID)

        <div class="editor-label">
            @Html.LabelFor(model => model.Title)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Title)
            @Html.ValidationMessageFor(model => model.Title)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Content)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.Content, new { @style="width:800px; height:600px" })
            @Html.ValidationMessageFor(model => model.Content)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.SubmitTime)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.SubmitTime)
            @Html.ValidationMessageFor(model => model.SubmitTime)
        </div>
        <div>
            <div id="datepicker" ></div>
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Submitter)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Submitter)
            @Html.ValidationMessageFor(model => model.Submitter)
        </div>

        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>
